﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MvcBHXH.Common;

namespace MvcBHXH.Models
{
    class TinhModel
    {

        private DataClassesBHYTTNDataContext context;
        public TinhModel() 
        {
            context = Util.CreateInstance().DataContext();
        }

        public List<TinhModel> GetTinhModel()
        {
            var Tinh = from fc in context.tbl_Tinhs
                       select new 
                       {
                            fc.Ma_Tinh,
                            fc.Ten_Tinh,
                            fc.GhiChu,
                       };
            List<TinhModel> listTinhModel = new List<TinhModel>();
            TinhModel tinhModel;
            foreach (var item in Tinh)
            {
                tinhModel = new TinhModel();
                tinhModel.MaTinh = item.Ma_Tinh;
                tinhModel.TenTinh = item.Ten_Tinh;
                tinhModel.GhiChu = item.GhiChu;
                listTinhModel.Add(tinhModel);
            }
            return listTinhModel;
        }


        private string maTinh;

        public string MaTinh
        {
            get { return maTinh; }
            set { maTinh = value; }
        }
        private string tenTinh;

        public string TenTinh
        {
            get { return tenTinh; }
            set { tenTinh = value; }
        }
        private string ghiChu;

        public string GhiChu
        {
            get { return ghiChu; }
            set { ghiChu = value; }
        }
    }
}
